# -*- coding: utf-8 -*-
# @Time    : 2024/9/6 下午2:43
# @Author  : liujun
# @Email   : 2592730854@qq.com
# @File    : release_upload_recipe_page.py
# @Software: PyCharm
from appium.webdriver.common.appiumby import AppiumBy as By
class ReleaseUploadRecipePage:
    """上传菜谱详情页面"""


    # 菜谱标题
    recipe_title_locator = (By.XPATH,
                            "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.ScrollView/android.widget.LinearLayout/android.widget.EditText[1]")

    #用料
    materials_used_locator=(By.XPATH,"/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.ScrollView/android.widget.LinearLayout/android.widget.FrameLayout[2]/android.widget.ScrollView/android.widget.LinearLayout/androidx.recyclerview.widget.RecyclerView[1]/android.view.ViewGroup/android.widget.EditText[1]")


    #步骤一
    step_one_locator=(By.XPATH,"/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.ScrollView/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.ScrollView/android.widget.LinearLayout/androidx.recyclerview.widget.RecyclerView[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout/android.widget.TextView")

    # 发布这个菜单按钮
    release_upload_btn_locator=(By.XPATH,"/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.ScrollView/android.widget.LinearLayout/android.widget.TextView")

    def __init__(self, driver):
        self.driver = driver


    def input_recipe_title(self, recipe_title):  # 输入菜谱标题
        self.driver.find_element(*self.recipe_title_locator).send_keys(recipe_title)


    def input_materials_used(self,materials_used):  #输入用料
        self.driver.find_element(*self.materials_used_locator).send_keys(materials_used)

    def click_step_one(self):  #点击步骤一
        self.driver.find_element(*self.step_one_locator).click()

    def click_release_upload_btn(self):
        self.driver.find_element(*self.release_upload_btn_locator).click()






